#ifndef MATERIALDIALOG_H
#define MATERIALDIALOG_H

#include <BTableWidget>
#include <BScrollWidget>
#include <BFloatSlider>
#include <BSlider>
#include <BDialog>
#include <BViewer>
#include <BMaterial>
#include <BGeoSphere>
#include <BCube>
#include <BCylinder>
#include <BLineEdit>
#include <BButton>
#include <BButtonGroup>

using namespace BWE;

class MaterialDialog : public BDialog
{
	BOBJECT(MaterialDialog)
public:
	MaterialDialog(BWidget* parent = 0);
	~MaterialDialog();

protected:
	void setMaterial(BMaterial* material);

	BViewer* initViewer();

protected:
	void slotAssetChanged(BObject* object, const BValue& value);

	void slotMateViewActived(BObject* object, const BValue& value);
	void slotCreateButtonClicked(BObject* object, const BValue& value);
	void slotDeleteButtonClicked(BObject* object, const BValue& value);
	void slotShapeButtonChecked(BObject* object, const BValue& value);

	void slotNameEditFinished();
	void slotAmbientEdited(BObject* object, const BValue& value);
	void slotDiffuseEdited(BObject* object, const BValue& value);
	void slotSpecularEdited(BObject* object, const BValue& value);
	void slotShininessEdited();

	void slotAddTextureButtonClicked();
	void slotTextureChanged(BObject* object);

protected:
	virtual void showEvent(const BEvent& event);

	virtual void updateEvent(const BEvent& event);

	virtual void styleEvent(const BEvent& event);
	virtual void paintEvent(const BEvent& event);

private:
	BViewer*				_mateView;
	BHolder<BButtonGroup>	_shapeButtonGroup;
	BButton*				_createButton;
	BButton*				_deleteButton;
	BLineEdit*				_nameEdit;
	BButton*				_ambientButton;
	BButton*				_diffuseButton;
	BButton*				_specularButton;
	BFloatSlider*			_shininessSlider;
	BScrollWidget*			_scrollWidget;
	BButtonHolder			_addTextureButton;

	BShapeHolder			_shape;
	BMaterialHolder			_material;
};

#endif